package com.yuan.plugin.adtool;

import com.yuan.myplugin.R;
import com.yuan.plugin.view.ImageToast;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.widget.Toast;

public class T {
	public static void show(Context context, String msg) {
		if (context != null) {
			new ImageToast(context, msg, R.drawable.gougou).show();
		}
	}

	public static void openQQ(Context context, String qq) {
		String url = "mqqwpa://im/chat?chat_type=wpa&uin=" + qq;
		try {
			Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(intent);
		} catch (Exception e) {
			Toast.makeText(context, "请安装QQ", 300).show();
		}
	}

	public static void dialPhone(Context context, String phone) {
		try {
			Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + phone));
			intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			context.startActivity(intent);
		} catch (Exception e) {
			Toast.makeText(context, "电话服务不可用", 300).show();
		}

	}

	public static void sendEMail(Context context, String mailAddr) {
		String[] reciver = new String[] { mailAddr };
		/*
		 * String[] mySbuject = new String[] { "test" }; String myCc = "cc";
		 * String mybody = "测试Email Intent";
		 */
		Intent myIntent = new Intent(android.content.Intent.ACTION_SEND);
		myIntent.setType("plain/text");
		myIntent.putExtra(android.content.Intent.EXTRA_EMAIL, reciver);
		/*
		 * myIntent.putExtra(android.content.Intent.EXTRA_CC, myCc);
		 * myIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mySbuject);
		 * myIntent.putExtra(android.content.Intent.EXTRA_TEXT, mybody);
		 */
		context.startActivity(Intent.createChooser(myIntent, "发送邮件"));
	}

}
